/** \file
 *	\brief Forces evaluation interface.
 */
#ifndef MDS_DYNAMICS_INCLUDED
#define MDS_DYNAMICS_INCLUDED 1

#include "../mds/potential.h"

/** \brief Compute accelerations from forces.
 *	
 *	frame->W is set during the loop.
 *	\param frame a valid frame with num_sets>=3.
 */
void mds_forces_to_accelerations( mds_frame *frame );

/** \brief Forces/Virial evaluation interface.
 *	
 *	\param frame  a valid frame with at least position,velocity,acceleration.
 *	\param Vproc  a pair potential/forces function.
 *	\param Vargs  extra arguments for Vproc.
 *	\param params parameters for forces evaluation method (cells, lists...)
 *	\remark MUST update the Virial in frame->W.
 */
typedef void (*mds_dynamics_proc)( mds_frame *frame, mds_potential_proc Vproc, void *Vargs, void *params );


/** \brief Parametrized Forces evaluation.
 */
typedef struct 
{
	mds_dynamics_proc gather; /*!< a valid Forces/Virial evaluation loop */
	void             *params; /*!< parameters for gather                 */
}
mds_dynamics;


/** \brief Forces evaluation call
 *
 *	\param dynamics a valid mds_dynamics structure.
 *
 *  This function performs dynamics->gather( frame, Vproc, Vargs, dynamics->params)
 *	then call mds_forces_to_accelerations( frame ):
 *	frame->V,frame->W and frame->sets[MDS_ACCELERATION] are computed.
 */
void mds_dynamics_call( mds_dynamics *dynamics, mds_frame *frame, mds_potential_proc Vproc, void *Vargs );


/** \brief Double loop evaluation.
 *	
 *	\param frame  a valid frame with at least position,velocity,acceleration.
 *	\param Vproc  a pair potential/forces function.
 *	\param Vargs  extra arguments for Vproc.
 *	\param params must be NULL
 */
void mds_dynamics_full(mds_frame         *frame, 
					   mds_potential_proc Vproc, 
					   void              *Vargs,
					   void              *params);



void mds_dynamics_full_simple( mds_frame         *frame, 
							   mds_potential_proc Vproc, 
							   void              *Vargs,
							   void              *params);



#endif

